<template>
  <el-mian>
    <el-form status-icon label-width="100px" class="demo-ruleForm">
      <el-form-item label="用户名称" prop="">
        <el-input type="username" v-model="ruleForm.username" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="确认密码" prop="checkPass">
        <el-input type="password" v-model="ruleForm.password" autocomplete="off"></el-input>
      </el-form-item>
    </el-form>
    <el-button @click="Login">登录</el-button>
  </el-mian>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      ruleForm:{
        username:'zhangsan',
        password:'123456'
      }
    };
  },
  methods:{
    Login() {
      this.axios.post('user/login',this.ruleForm).then(res=>{
        debugger
        if (res.data.code == 200) {
          localStorage.setItem("token", res.data.data);
          this.$router.replace("/hetong")
        }else {
          this.$message.error(res.data.msg);
        }
      })
    }
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>